<!-- 教师列表 -->
<template>
  <div class="page-box h100 display-flex czbj">
    <!-- sonRouter="yybureauFormationBJ" 为跳转新的页面编辑 -->
    <dxtable
      :dataJson="dataJson"
      :portUrl="portUrl"
      :formJson="formJson"
      :qx="qx"
      ref="databale"
      :fixed="true"
    ></dxtable>
  </div>
</template>
<script lang="ts" setup>
import dxtable from "../../../components/util/dxtable.vue";
import sort from "../../../components/util/sort.vue";
import { dxget, dxpost } from "../../../util/index";
import { NButton, NImage, NTag } from "naive-ui";
import { h, ref, reactive } from "vue";
const databale = ref();
const initeer = () => {
  databale.value.initDataExpose();
};
const xmlxSelect = ref([]);
let dataJson = [
  {
    title: "姓名",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "name",
    width: "100",
    search: true,
    istable: true,
    required: false,
  },
  {
    title: "电话",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "phone",
    width: "120",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "密码",
    key: "paw",
    width: "100",
  },
  {
    title: "个人形象照",
    type: "img",
    val: "",
    icon: "dx-img",
    span: 12,
    key: "cover",
    width: "100",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "教师资格证",
    type: "img",
    span: 12,
    width: "100",
    key: "xcxdfa",
  },

  {
    title: "身份证",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "IDCard",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "所属机构",
    type: "mapdz",
    icon: "dx-ditu",
    keyjw: "",
    span: 12,
    key: "jgname",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "学历",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "xueli",
    width: "",
    search: true,
    istable: true,
    required: false,
  },
  {
    title: "毕业学校",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "byyx",
    width: "",
    search: true,
    istable: true,
    required: false,
  },
  {
    title: "添加时间",
    key: "addTime",
    width: 150,
  },
];

const qx = {
  DeletePermissionID: "123456", //删除
  EditPermissionIdentifier: "cteacherListbj", // 编辑
  NewPermissionIdentifier: "cteacherListxz", // 新建
  ViewPermissionID: "cteacherListck", // 查看
};
localStorage.Userid = "88887745";
const portUrl = "courseManagement/teacher";

let formJson = reactive([
  {
    title: "机构",
    type: "select",
    options: [],
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "jigouId",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "姓名",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "name",
    width: "",
    search: false,
    istable: true,
    required: false,
  },

  {
    title: "电话",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "phone",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "登录密码",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "paw",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "身份证",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "IDCard",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "地址",
    type: "mapdz",
    icon: "dx-ditu",
    keyjw: "",
    span: 12,
    key: "dizhi",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "学历",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "xueli",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "毕业学校",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "byyx",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "工作方式",
    type: "radio",
    icon: "dx-radiobox",
    val: "",
    opt: [
      {
        label: "全职",
        value: "全职",
      },
      {
        label: "兼职",
        value: "兼职",
      },
    ],
    span: 12,
    key: "gzfs",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "教师资格证",
    type: "radio",
    icon: "dx-radiobox",
    val: "",
    opt: [
      {
        label: "有",
        value: "1",
      },
      {
        label: "没有",
        value: "2",
      },
    ],
    span: 12,
    key: "jszg",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "教学概念",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 24,
    key: "jxgy",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "个人简介",
    type: "textarea",
    val: "",
    icon: "dx-duohangwenben",
    span: 24,
    key: "grjj",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "照片",
    type: "img",
    val: "",
    icon: "dx-img",
    span: 12,
    key: "cover",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "教师资格证",
    type: "img",
    span: 12,
    key: "xcxdfa",
  },
]);
const czFun = {
  fun: (row) => {
    return [
      h(
        NButton,
        {
          type: "info",
          quaternary: true,
          onClick: async (e) => {},
        },
        "复制代码"
      ),
    ];
  },
};

// 获取机构
const xtgxxmfl = async () => {
  const { data }: any = await dxget("courseManagement/api/getjigou", {});
  dataJson[0].options = [
    {
      label: "全部",
      value: "",
    },
    ...data,
  ];
  formJson[0].options = data;
  xmlxSelect.value = data;
  console.log(data);
};
xtgxxmfl();
</script>
<style scoped></style>
